UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HYwul4+yuEgymhySuAiaP14fwYuRScuoHJDjlRo2Zb8=' 
WHERE 
  key_id = '95ee78995108270302f7311aea25de5f6de77d136494a6b8e557ccd879730f14' 
  AND (
    token = 'HYwul4+yuEgymhySuAiaP14fwYuRScuoHJDjlRo2Zb8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00068