UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l8QcB6C9aynK+o0zomcf0Equ8ZdkNCRI8IVPtzMcJAM=' 
WHERE 
  key_id = '0acd54426a3584eba4eadf8bc80780314d8ea14f20a8b63b8556c624b07ac6a9' 
  AND (
    token = 'l8QcB6C9aynK+o0zomcf0Equ8ZdkNCRI8IVPtzMcJAM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046