UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TRk83AHnS7RqoyEo3YXgI65MxTWcWAjQ0GdlcwuKkbc=' 
WHERE 
  key_id = '976f73142a2ed1ac9228f5b82f4838d67ca16b5ffa6aa16996750fdbc98857cd' 
  AND (
    token = 'TRk83AHnS7RqoyEo3YXgI65MxTWcWAjQ0GdlcwuKkbc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031