UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fikKDkcnKeepTMZCSdIxjyuipmdN8aKyFvzqZvw+YHs=' 
WHERE 
  key_id = '00815baab612f23933d3e465d02b2ccf7f1234a5bca4b6312012feb8d8d18123' 
  AND (
    token = 'fikKDkcnKeepTMZCSdIxjyuipmdN8aKyFvzqZvw+YHs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00235