UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b08WvLftoAjReIy9ZJiXSDsmHrrJyRIg8A7VI9aLqAw=' 
WHERE 
  key_id = 'fc786abd883a6a99a913933b6b46fee659a7867d06707c113d19e70152e107b1' 
  AND (
    token = 'b08WvLftoAjReIy9ZJiXSDsmHrrJyRIg8A7VI9aLqAw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031