UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eIFMcQ2q2iJ/6g661tK1Zllv+UIt9b7uHnjWWwSrnw8=' 
WHERE 
  key_id = '78d48550dff993a757ef17051f8006582aeef76135e304de5550a0df630c3f82' 
  AND (
    token = 'eIFMcQ2q2iJ/6g661tK1Zllv+UIt9b7uHnjWWwSrnw8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00100