UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bp/Qla1UNfUwD8t49Ss97uOqiCf9DcmOS+rK3A6/Brw=' 
WHERE 
  key_id = 'c2b5c4c8a200eae3685d91b5d58141af41486523b8796266e751dec6773d8ec4' 
  AND (
    token = 'Bp/Qla1UNfUwD8t49Ss97uOqiCf9DcmOS+rK3A6/Brw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031