UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Iv9WIoli6hWyWzcHFHnS+eyE3NVBIiqKmu5tDbyVb50=' 
WHERE 
  key_id = '0cebd199d59947e49dba4bae72571aa12b13109ba14478adc1cbf2932250ed48' 
  AND (
    token = 'Iv9WIoli6hWyWzcHFHnS+eyE3NVBIiqKmu5tDbyVb50=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036