UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0b9Uxvm4tr7+p4IitDdxW1yVdm7ETg7+hFktV9c4hnc=' 
WHERE 
  key_id = '2709c6ce2afdc81f66dc9b8cf81e904124796b08da8f1c7ba39b3965a13e1ef2' 
  AND (
    token = '0b9Uxvm4tr7+p4IitDdxW1yVdm7ETg7+hFktV9c4hnc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029