UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i/tZUVjbBB282Gy+KKp+1BuV/v/c5Isq6F2dkq7MK14=' 
WHERE 
  key_id = '13cc26edef55a3756f906187744bccb25bb8f978650412829f285423edd211b9' 
  AND (
    token = 'i/tZUVjbBB282Gy+KKp+1BuV/v/c5Isq6F2dkq7MK14=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037