UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cRBY90bSwn8Fs9nQiQjV0bbibZJCXSA/LJ9i+iSp1n4=' 
WHERE 
  key_id = 'f5e2b9e4dff18b2b8744a8c28b8b34fd48f9593a445c0fb0555b8bcd516f11d3' 
  AND (
    token = 'cRBY90bSwn8Fs9nQiQjV0bbibZJCXSA/LJ9i+iSp1n4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036