UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y6OUMMgu3XqV8apI8mcFL+9vjz9ofzW9f+UVfPmew3o=' 
WHERE 
  key_id = 'f43812bd30ad4a7a1384cb85672115225d628b7802a2c73676024e8425901581' 
  AND (
    token = 'Y6OUMMgu3XqV8apI8mcFL+9vjz9ofzW9f+UVfPmew3o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051