UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xgPCEM9jUEvywbq9RCeSVwRDvLPLAgQWbPYok5/RGbo=' 
WHERE 
  key_id = '8362bafc46054aa32d77464a201c189de0d2d38c55a98211bfc992e3c306e70e' 
  AND (
    token = 'xgPCEM9jUEvywbq9RCeSVwRDvLPLAgQWbPYok5/RGbo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030