UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pdzth/T5aLVmGAVqKGHmkrrQhy+8FamFiNYjLins0b4=' 
WHERE 
  key_id = 'c9fad8a172671b439ebd1d6ea67e84947973431a7a049b02654a0ad8827700af' 
  AND (
    token = 'pdzth/T5aLVmGAVqKGHmkrrQhy+8FamFiNYjLins0b4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030