UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mK7FCt5nKoRD1eaDsq03Oy73UGbgfvmXLCwzQeJMO3Q=' 
WHERE 
  key_id = '7fcacf56ba021889211ff5d7fce72bd352cc01993f3f0dfa24849bc3223719cc' 
  AND (
    token = 'mK7FCt5nKoRD1eaDsq03Oy73UGbgfvmXLCwzQeJMO3Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031