UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0t4qyo9g72+9WmFiiXjmXcsRgUDvLGZRxAuH6tzqOMk=' 
WHERE 
  key_id = 'b90bec99e76f9bce171cb7d85605df16e297c0d37521da8aba2534eb8b9e1776' 
  AND (
    token = '0t4qyo9g72+9WmFiiXjmXcsRgUDvLGZRxAuH6tzqOMk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021