UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'psww6Y09hiDt9mWjCu8jibxh4E/+4EbRFDorg7ADB38=' 
WHERE 
  key_id = '550c12b253ab6c826315919330234362467995e0d3a541b266945db17926b4f0' 
  AND (
    token = 'psww6Y09hiDt9mWjCu8jibxh4E/+4EbRFDorg7ADB38=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031