UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dXgvJ6vjmqPHQa0EQlsy9Xn7QLlbge4UghNO6XcaCaI=' 
WHERE 
  key_id = 'c5a04d11deca18195107457f6f9bd2f083664dba6c055f5f94e3f9a42de86fe3' 
  AND (
    token = 'dXgvJ6vjmqPHQa0EQlsy9Xn7QLlbge4UghNO6XcaCaI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038