UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U38AeIHnD/wioWoBb7VSCXSEswczJyskdtUIi0uwzpU=' 
WHERE 
  key_id = 'b6fc6b9a63c7504890fc4850c2132372c1f2270e3441c36a9326104927c883b3' 
  AND (
    token = 'U38AeIHnD/wioWoBb7VSCXSEswczJyskdtUIi0uwzpU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052