UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GmOmCOQVrbhsHuc0WNy1sa1684WfcffFfhFQ7e0Qr48=' 
WHERE 
  key_id = '05ad38de5ac1127031f84521715e5c1441a62b3b606de6080a60e7fa4e1b9664' 
  AND (
    token = 'GmOmCOQVrbhsHuc0WNy1sa1684WfcffFfhFQ7e0Qr48=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037