UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Qv71evC+nnDpplzF+xShfwkpaMwigWkfIOSNva29zVI=' 
WHERE 
  key_id = '225e86c9c57849aa42b2c92d52b845cc974de5998a17a075e7ef1c4459178583' 
  AND (
    token = 'Qv71evC+nnDpplzF+xShfwkpaMwigWkfIOSNva29zVI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016