UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j2edpQL0U5eDdiSV7Ol0pfpLq2IH9fthfEAoBLrz+9g=' 
WHERE 
  key_id = '22e4244419ad7f5e24378f47683fbe3414c620eeaab533602284a50107c293b4' 
  AND (
    token = 'j2edpQL0U5eDdiSV7Ol0pfpLq2IH9fthfEAoBLrz+9g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023