UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S4XHJHQyfB46wEPTl/XnFq5xhL2XJTywR0/2uHbTVIs=' 
WHERE 
  key_id = '36d91bb97a85f478f3d26c9efea3feb1d9ba085c481afcebc3150307bd746716' 
  AND (
    token = 'S4XHJHQyfB46wEPTl/XnFq5xhL2XJTywR0/2uHbTVIs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039