UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4AOEbXLZJDhHXdNNEPLFQiC+lWxhh7hL6oeAXczBubY=' 
WHERE 
  key_id = '40bd77914127394f86016b6de9d659710167d96ad61312def4ce4a6db838402c' 
  AND (
    token = '4AOEbXLZJDhHXdNNEPLFQiC+lWxhh7hL6oeAXczBubY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027