UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '46znRqtK9ouo5+NMdwsbm9wS1OMbbBElbALT2fW5ufU=' 
WHERE 
  key_id = 'e61753e6df387687662d8db5015981ed51393abd908de4c8ad8d6b98db5154d5' 
  AND (
    token = '46znRqtK9ouo5+NMdwsbm9wS1OMbbBElbALT2fW5ufU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044