UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9VNIZQRn+ACNxpsmMCaHfJPX5w1dXe0Tr51MuYygqKY=' 
WHERE 
  key_id = '0a47e42e9088618540787db6f1c57248dc146bb55e054368076e3d3705fdb1cf' 
  AND (
    token = '9VNIZQRn+ACNxpsmMCaHfJPX5w1dXe0Tr51MuYygqKY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035