UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b8l7cxeHskz/iALguv2YUXxfres83Pv/nZB9J6/jY5E=' 
WHERE 
  key_id = 'b81a7f6b66a596470f7a25c5391408ace4b766a9e3ddb815fb6381f01770a86e' 
  AND (
    token = 'b8l7cxeHskz/iALguv2YUXxfres83Pv/nZB9J6/jY5E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034